package cn.edu.imau.zy.system.service.impl;

import cn.edu.imau.zy.common.core.entity.student.StStudent;
import cn.edu.imau.zy.common.core.entity.system.SysSignJob;
import cn.edu.imau.zy.common.core.text.Convert;
import cn.edu.imau.zy.common.utils.DateUtils;
import cn.edu.imau.zy.system.mapper.SysSignJobMapper;
import cn.edu.imau.zy.system.service.ISysSignJobService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 签到任务Service业务层处理
 * 
 * @author wyz
 * @date 2020-07-07
 */
@Service
public class SysSignJobServiceImpl extends ServiceImpl<SysSignJobMapper,SysSignJob> implements ISysSignJobService
{
    @Autowired
    private SysSignJobMapper sysSignJobMapper;

    /**
     * 查询签到任务
     * 
     * @param id 签到任务ID
     * @return 签到任务
     */
    @Override
    public SysSignJob selectSysSignJobById(String id)
    {
        return sysSignJobMapper.selectSysSignJobById(id);
    }

    /**
     * 查询签到任务列表
     * 
     * @param sysSignJob 签到任务
     * @return 签到任务
     */
    @Override
    public List<SysSignJob> selectSysSignJobList(SysSignJob sysSignJob)
    {
        return sysSignJobMapper.selectSysSignJobList(sysSignJob);
    }

    /**
     * 新增签到任务
     * 
     * @param sysSignJob 签到任务
     * @return 结果
     */
    @Override
    public int insertSysSignJob(SysSignJob sysSignJob)
    {
        sysSignJob.setCreateTime(DateUtils.getNowDate());
        return sysSignJobMapper.insertSysSignJob(sysSignJob);
    }

    /**
     * 修改签到任务
     * 
     * @param sysSignJob 签到任务
     * @return 结果
     */
    @Override
    public int updateSysSignJob(SysSignJob sysSignJob)
    {
        sysSignJob.setUpdateTime(DateUtils.getNowDate());
        return sysSignJobMapper.updateSysSignJob(sysSignJob);
    }

    /**
     * 删除签到任务对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysSignJobByIds(String ids)
    {
        return sysSignJobMapper.deleteSysSignJobByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除签到任务信息
     * 
     * @param id 签到任务ID
     * @return 结果
     */
    @Override
    public int deleteSysSignJobById(String id)
    {
        return sysSignJobMapper.deleteSysSignJobById(id);
    }

    @Override
    public List<StStudent> selectStudents(Map params) {
        return sysSignJobMapper.selectStudents(params);
    }

    @Override
    public List<Map<String, Object>> counts() {
        return sysSignJobMapper.counts();
    }
}
